from time import time

class BBPeer(object):
    ACTIVITY_TIMEOUT = 300

    def __init__(self, addr):
        super(BBPeer, self).__init__()
        self.addr = addr
        self.timestamp = time()

    def update_timestamp(self):
        self.timestamp = time()

    def __cmp__(self, other):
        if type(self) == type(other):
            return cmp(self.addr, other.addr)
        else:
            return cmp(self.addr, other)
